package zcx;

import java.util.Date;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.02.09.15.56
 */
@Username
public class User {
    private int id;
    @Username(name="周从喜")
    private String name;
    private Date brith;
    private double money;


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getBrith() {
        return brith;
    }

    public void setBrith(Date brith) {
        this.brith = brith;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    public User(int id, String name, Date brith, double money) {
        this.id = id;
        this.name = name;
        this.brith = brith;
        this.money = money;
    }

    public User() {
    }
    @Username(name="张三丰")
    public void show(){

        try {
            var m=this.getClass().getDeclaredMethod("show");
            if(m.isAnnotationPresent(Username.class)){
                System.out.println(m.getAnnotation(Username.class).name());
            }
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
    }
}
